package com.jeesite.modules.sys.entity;

import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import com.jeesite.common.entity.DataEntity;
import com.jeesite.common.mybatis.annotation.Column;
import com.jeesite.common.mybatis.annotation.Table;
import com.jeesite.common.mybatis.mapper.query.QueryType;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.Size;

/**
 * 组织账套Entity
 * @author 码脑洞
 * @version 2025-04-07
 */
@Table(name="t_organization", alias="a", label="组织账套信息", columns={
		@Column(name="auto_id", attrName="autoId", label="主键", isPK=true),
		@Column(name="org_code", attrName="orgCode", label="组织编码"),
		@Column(name="org_name", attrName="orgName", label="组织名称", queryType=QueryType.LIKE),
		@Column(name="ent_code", attrName="entCode", label="企业代码", isQuery=false),
		@Column(name="erp_db_name", attrName="erpDbName", label="数据库名称", isQuery=false),
		@Column(name="erp_db_schemas", attrName="erpDbSchemas", label="数据库模式", isQuery=false),
		@Column(name="db_user", attrName="dbUser", label="数据库用户", isQuery=false),
		@Column(name="db_pwd", attrName="dbPwd", label="数据库密码", isQuery=false),
		@Column(name="db_alias", attrName="dbAlias", label="数据库别名", isQuery=false),
		@Column(name="db_url_inner", attrName="dbUrlInner", label="数据库内网地址", isQuery=false),
		@Column(name="db_url_outter", attrName="dbUrlOutter", label="数据库外网地址", isQuery=false),
		@Column(name="api_url_inner", attrName="apiUrlInner", label="api内网地址", isQuery=false),
		@Column(name="api_url_outter", attrName="apiUrlOutter", label="api外网地址", isQuery=false),
		@Column(name="default_flag", attrName="defaultFlag", label="是否默认", isQuery=false),
		@Column(includeEntity=DataEntity.class),
	}, orderBy="a.update_date DESC"
)
public class Organization extends DataEntity<Organization> {
	
	private static final long serialVersionUID = 1L;
	private Long autoId;		// 主键
	private String orgCode;		// 组织编码
	private String orgName;		// 组织名称
	private String entCode;		// 企业代码
	private String erpDbName;		// 数据库名称
	private String erpDbSchemas;		// 数据库模式
	private String dbUser;		// 数据库用户
	private String dbPwd;		// 数据库密码
	private String dbAlias;		// 数据库别名
	private String dbUrlInner;		// 数据库内网地址
	private String dbUrlOutter;		// 数据库外网地址
	private String apiUrlInner;		// api内网地址
	private String apiUrlOutter;		// api外网地址
	private String defaultFlag;		// 是否默认

	public Organization() {
		this(null);
	}
	
	public Organization(String id){
		super(id);
	}
	
	@JsonSerialize(using = ToStringSerializer.class)
	public Long getAutoId() {
		return autoId;
	}

	public void setAutoId(Long autoId) {
		this.autoId = autoId;
	}
	
	@NotBlank(message="组织编码不能为空")
	@Size(min=0, max=10, message="组织编码长度不能超过 10 个字符")
	public String getOrgCode() {
		return orgCode;
	}

	public void setOrgCode(String orgCode) {
		this.orgCode = orgCode;
	}
	
	@NotBlank(message="组织名称不能为空")
	@Size(min=0, max=30, message="组织名称长度不能超过 30 个字符")
	public String getOrgName() {
		return orgName;
	}

	public void setOrgName(String orgName) {
		this.orgName = orgName;
	}
	
	@Size(min=0, max=20, message="企业代码长度不能超过 20 个字符")
	public String getEntCode() {
		return entCode;
	}

	public void setEntCode(String entCode) {
		this.entCode = entCode;
	}
	
	@NotBlank(message="数据库名称不能为空")
	@Size(min=0, max=50, message="数据库名称长度不能超过 50 个字符")
	public String getErpDbName() {
		return erpDbName;
	}

	public void setErpDbName(String erpDbName) {
		this.erpDbName = erpDbName;
	}
	
	@NotBlank(message="数据库模式不能为空")
	@Size(min=0, max=10, message="数据库模式长度不能超过 10 个字符")
	public String getErpDbSchemas() {
		return erpDbSchemas;
	}

	public void setErpDbSchemas(String erpDbSchemas) {
		this.erpDbSchemas = erpDbSchemas;
	}
	
	@Size(min=0, max=50, message="数据库用户长度不能超过 50 个字符")
	public String getDbUser() {
		return dbUser;
	}

	public void setDbUser(String dbUser) {
		this.dbUser = dbUser;
	}
	
	@Size(min=0, max=50, message="数据库密码长度不能超过 50 个字符")
	public String getDbPwd() {
		return dbPwd;
	}

	public void setDbPwd(String dbPwd) {
		this.dbPwd = dbPwd;
	}
	
	@NotBlank(message="数据库别名不能为空")
	@Size(min=0, max=10, message="数据库别名长度不能超过 10 个字符")
	public String getDbAlias() {
		return dbAlias;
	}

	public void setDbAlias(String dbAlias) {
		this.dbAlias = dbAlias;
	}
	
	@Size(min=0, max=250, message="数据库内网地址长度不能超过 250 个字符")
	public String getDbUrlInner() {
		return dbUrlInner;
	}

	public void setDbUrlInner(String dbUrlInner) {
		this.dbUrlInner = dbUrlInner;
	}
	
	@Size(min=0, max=250, message="数据库外网地址长度不能超过 250 个字符")
	public String getDbUrlOutter() {
		return dbUrlOutter;
	}

	public void setDbUrlOutter(String dbUrlOutter) {
		this.dbUrlOutter = dbUrlOutter;
	}
	
	@Size(min=0, max=250, message="api内网地址长度不能超过 250 个字符")
	public String getApiUrlInner() {
		return apiUrlInner;
	}

	public void setApiUrlInner(String apiUrlInner) {
		this.apiUrlInner = apiUrlInner;
	}
	
	@Size(min=0, max=250, message="api外网地址长度不能超过 250 个字符")
	public String getApiUrlOutter() {
		return apiUrlOutter;
	}

	public void setApiUrlOutter(String apiUrlOutter) {
		this.apiUrlOutter = apiUrlOutter;
	}
	
	@Size(min=0, max=1, message="是否默认长度不能超过 1 个字符")
	public String getDefaultFlag() {
		return defaultFlag;
	}

	public void setDefaultFlag(String defaultFlag) {
		this.defaultFlag = defaultFlag;
	}
	
}